﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace HigLabo.Net.Twitter
{
    public partial class TwitterClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        public UserCollection LookupUsers(params Int64[] values)
        {
            StringBuilder sb = new StringBuilder(256);
            for (int i = 0; i < values.Length; i++)
            {
                sb.Append(values[i]);
                if (i < values.Length - 1)
                {
                    sb.Append(",");
                }
            }
            var cm = new LookupUserCommand();
            cm.UserID = sb.ToString();
            return this.LookupUsers(cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        public UserCollection LookupUsers(params String[] values)
        {
            StringBuilder sb = new StringBuilder(256);
            for (int i = 0; i < values.Length; i++)
            {
                sb.Append(values[i]);
                if (i < values.Length - 1)
                {
                    sb.Append(",");
                }
            }
            var cm = new LookupUserCommand();
            cm.ScreenName = sb.ToString();
            return this.LookupUsers(cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public UserCollection LookupUsers(LookupUserCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.Users.LookupUrl, command);
            return new UserCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public UserCollection SearchUsers(String query)
        {
            return this.SearchUsers(new SearchUserCommand() { Query = query });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public UserCollection SearchUsers(SearchUserCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.Users.SearchUrl, command);
            return new UserCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public User ShowUser(Int64 id)
        {
            return this.ShowUser(new ShowUserCommand() { UserID = id });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="screenName"></param>
        /// <returns></returns>
        public User ShowUser(String screenName)
        {
            return this.ShowUser(new ShowUserCommand() { ScreenName = screenName });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public User ShowUser(ShowUserCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.Users.ShowUrl, command);
            return new User(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public UserCollection GetContributees(Int64 id)
        {
            return this.GetContributees(new GetContributeesCommand() { UserID = id });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="screenName"></param>
        /// <returns></returns>
        public UserCollection GetContributees(String screenName)
        {
            return this.GetContributees(new GetContributeesCommand() { ScreenName = screenName });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public UserCollection GetContributees(GetContributeesCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.Users.ContributeesUrl, command);
            return new UserCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public UserCollection GetContributors(Int64 id)
        {
            return this.GetContributors(new GetContributorsCommand() { UserID = id });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="screenName"></param>
        /// <returns></returns>
        public UserCollection GetContributors(String screenName)
        {
            return this.GetContributors(new GetContributorsCommand() { ScreenName = screenName });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public UserCollection GetContributors(GetContributorsCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.Users.ContributorsUrl, command);
            return new UserCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BannerInfo GetProfileBanner(Int64 id)
        {
            return this.GetProfileBanner(new GetProfileBannerCommand() { UserID = id });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="screenName"></param>
        /// <returns></returns>
        public BannerInfo GetProfileBanner(String screenName)
        {
            return this.GetProfileBanner(new GetProfileBannerCommand() { ScreenName = screenName });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public BannerInfo GetProfileBanner(GetProfileBannerCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.Users.GetProfileBannerUrl, command);
            return new BannerInfo(jsonText);
        }

    }
}
